<template>
  <van-sticky>
    <van-search
    v-model="value"
    show-action
    placeholder="请输入搜索关键词"
    background="tomato"
    shape="round"
    @focus="gosearch"
  >
    <template #left>
      <div @click="goAddress">{{cityName}}&nbsp;&nbsp;</div>
      <!-- <div @click="goAddress">北京&nbsp;&nbsp;</div> -->
      <!-- <div>北京&nbsp;&nbsp;</div> -->
      &nbsp;&nbsp;
    </template>
    <template #label>
      <div>
        <van-icon name="chat-o" />
      </div>
    </template>
    <template #action>
      <div>搜索</div>
    </template>
  </van-search>
  </van-sticky>
  
</template>

<script>
export default {
  data() {
    return {
      value: "",
    };
  },
  computed:{
    cityName:function(){
      return localStorage.getItem("cityName")?localStorage.getItem("cityName"):"北京";
    }
  },
  methods:{
    goAddress(){
      this.$router.push("/Address");
    },
    gosearch(){
      this.$router.push('/mysearch')
    }
  }
};
</script>

<style>
</style>